package com.zzw.basic.io;

import java.io.FileOutputStream;
import java.nio.channels.FileChannel;
import java.nio.channels.FileLock;

public class FileLockTest {

	public static void main(String[] args) {
		try {
			FileChannel channel = new FileOutputStream("../ReflectDemo/src/main/resources/test.txt").getChannel();
			FileLock lock = channel.tryLock();
			Thread.sleep(10000);
			lock.release();
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

}
